<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template any</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.any_hpp" title="Header &lt;boost/type_erasure/any.hpp&gt;">
<link rel="prev" href="../../boost_typeerasure/reference.html" title="Reference">
<link rel="next" href="any_Conc_1_3_40_13_1_1_1_2.html" title="Class template any&lt;Concept, const T &amp;&gt;">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../boost_typeerasure/reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.any_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="any_Conc_1_3_40_13_1_1_1_2.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.type_erasure.any"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template any</span></h2>
<p>boost::type_erasure::any</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.any_hpp" title="Header &lt;boost/type_erasure/any.hpp&gt;">boost/type_erasure/any.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept<span class="special">,</span> <span class="keyword">typename</span> T <span class="special">=</span> <a class="link" href="_self.html" title="Struct _self">_self</a><span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="any.html" title="Class template any">any</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="any.html#boost.type_erasure.anyconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_4-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_5-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">typename</span> Map<span class="special">&gt;</span> <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_6-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="static_binding.html" title="Struct template static_binding">static_binding</a><span class="special">&lt;</span> <span class="identifier">Map</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_7-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept2<span class="special">,</span> <span class="keyword">typename</span> Tag2<span class="special">&gt;</span> 
    <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_8-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a><span class="special">&lt;</span> <span class="identifier">Concept2</span><span class="special">,</span> <span class="identifier">Tag2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept2<span class="special">,</span> <span class="keyword">typename</span> Tag2<span class="special">,</span> <span class="keyword">typename</span> Map<span class="special">&gt;</span> 
    <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_9-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a><span class="special">&lt;</span> <span class="identifier">Concept2</span><span class="special">,</span> <span class="identifier">Tag2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="static_binding.html" title="Struct template static_binding">static_binding</a><span class="special">&lt;</span> <span class="identifier">Map</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept2<span class="special">,</span> <span class="keyword">typename</span> Tag2<span class="special">&gt;</span> 
    <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_10-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a><span class="special">&lt;</span> <span class="identifier">Concept2</span><span class="special">,</span> <span class="identifier">Tag2</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="binding.html" title="Class template binding">binding</a><span class="special">&lt;</span> <span class="identifier">Concept</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> U<span class="special">&gt;</span> <span class="keyword">explicit</span> <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_11-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> U<span class="special">&gt;</span> <span class="keyword">explicit</span> <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_12-bb"><span class="identifier">any</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="binding.html" title="Class template binding">binding</a><span class="special">&lt;</span> <span class="identifier">Concept</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a class="link" href="any.html" title="Class template any">any</a> <span class="special">&amp;</span> <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_13-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="any.html#id-1_3_40_13_1_1_1_1_14-bb"><span class="special">~</span><span class="identifier">any</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.40.13.2.3.4"></a><h2>Description</h2>
<p>The class template <a class="link" href="any.html" title="Class template any">any</a> can store any object that models a specific  <a class="link" href="../../boost_typeerasure/conceptdef.html" title="Concept Definitions">Concept</a>. It dispatches all the functions defined by the  <a class="link" href="../../boost_typeerasure/conceptdef.html" title="Concept Definitions">Concept</a> to the contained type at runtime.</p>
<p>
</p>
<p><span class="bold"><strong>See Also:</strong></span></p>
<p><a class="link" href="concept_of.html" title="Struct template concept_of">concept_of</a>, <a class="link" href="placeholder_of.html" title="Struct template placeholder_of">placeholder_of</a>,  <a class="link" href="any_cast.html" title="Function any_cast">any_cast</a>,  <a class="link" href="is_empty.html" title="Function template is_empty">is_empty</a>,  <a class="link" href="binding_of.html" title="Function template binding_of">binding_of</a>,  <a class="link" href="typeid_of.html" title="Function typeid_of">typeid_of</a> </p>
<p>
</p>
<p>
</p>
<div class="refsect2">
<a name="id-1.3.40.13.2.3.4.4"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Concept</pre>
<p>The  <a class="link" href="../../boost_typeerasure/conceptdef.html" title="Concept Definitions">Concept</a> that the stored type should model. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> T <span class="special">=</span> <a class="link" href="_self.html" title="Struct _self">_self</a></pre>
<p>A <code class="computeroutput"><a class="link" href="placeholder.html" title="Struct placeholder">placeholder</a></code> specifying which type this is.</p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.40.13.2.3.4.5"></a><h3>
<a name="boost.type_erasure.anyconstruct-copy-destruct"></a><code class="computeroutput">any</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="id-1_3_40_13_1_1_1_1_4-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Constructs an empty <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>.</p>
<p>Except as otherwise noted, all operations on an empty <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> result in a <code class="computeroutput"><a class="link" href="bad_function_call.html" title="Class bad_function_call">bad_function_call</a></code> exception. The copy-constructor of an empty <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> creates another null <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>. The destructor of an empty <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> is a no-op. Comparison operators treat all empty <code class="computeroutput"><a class="link" href="any.html" title="Class template any">anys</a></code> as equal.  <code class="computeroutput"><a class="link" href="typeid_of.html" title="Function typeid_of">typeid_of</a></code> applied to an empty <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> returns <code class="computeroutput">typeid(void)</code>.</p>
<p>An <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> which does not include <code class="computeroutput"><a class="link" href="relaxed.html" title="Struct relaxed">relaxed</a></code> in its  <a class="link" href="../../boost_typeerasure/conceptdef.html" title="Concept Definitions">Concept</a> can never be null.</p>
<p>

</p>
<p><span class="bold"><strong>See Also:</strong></span></p>
<p> <code class="computeroutput"><a class="link" href="is_empty.html" title="Function template is_empty">is_empty</a></code> </p>
<p>
</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><a class="link" href="relaxed.html" title="Struct relaxed">relaxed</a> must be in <code class="computeroutput">Concept</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a name="id-1_3_40_13_1_1_1_1_5-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span> data<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> to hold a copy of <code class="computeroutput">data</code>. The <code class="computeroutput">Concept</code> will be instantiated with the placeholder <code class="computeroutput">T</code> bound to U.</p>
<p>




</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This constructor never matches if the argument is an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>, <code class="computeroutput"><a class="link" href="binding.html" title="Class template binding">binding</a></code>, or <code class="computeroutput"><a class="link" href="static_binding.html" title="Struct template static_binding">static_binding</a></code>. </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">data</code></span></p></td>
<td><p>The object to store in the <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">U</code> is a model of <code class="computeroutput">Concept</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">U</code> must be <a href="../../../../doc/html/CopyConstructible.html" target="_top">CopyConstructible</a>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must not refer to any non-deduced placeholder besides <code class="computeroutput">T</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the copy constructor of <code class="computeroutput">U</code> throws.</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">typename</span> Map<span class="special">&gt;</span> 
  <a name="id-1_3_40_13_1_1_1_1_6-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span> data<span class="special">,</span> <span class="keyword">const</span> <a class="link" href="static_binding.html" title="Struct template static_binding">static_binding</a><span class="special">&lt;</span> <span class="identifier">Map</span> <span class="special">&gt;</span> <span class="special">&amp;</span> binding<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> to hold a copy of <code class="computeroutput">data</code> with explicitly specified placeholder bindings.</p>
<p>





</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This constructor never matches if the argument is an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>. </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">binding</code></span></p></td>
<td><p>Specifies the types that all the placeholders should bind to.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">data</code></span></p></td>
<td><p>The object to store in the <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>. </p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">U</code> is a model of <code class="computeroutput">Concept</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">U</code> must be <a href="../../../../doc/html/CopyConstructible.html" target="_top">CopyConstructible</a>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Map</code> is an MPL map with an entry for every non-deduced placeholder referred to by <code class="computeroutput">Concept</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput"><code class="computeroutput">T</code> must</code> map to <code class="computeroutput">U</code> in <code class="computeroutput">Map</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the copy constructor of <code class="computeroutput">U</code> throws.</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="id-1_3_40_13_1_1_1_1_7-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<p>Copies an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>.</p>
<p>


</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">other</code></span></p></td>
<td><p>The object to make a copy of.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must contain <a class="link" href="constructible.html" title="Struct template constructible">constructible&lt;T(const T&amp;)&gt;</a>. (This is included in <a class="link" href="copy_constructible.html" title="Struct template copy_constructible">copy_constructible&lt;T&gt;</a>)</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the copy constructor of the contained type throws. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept2<span class="special">,</span> <span class="keyword">typename</span> Tag2<span class="special">&gt;</span> 
  <a name="id-1_3_40_13_1_1_1_1_8-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a><span class="special">&lt;</span> <span class="identifier">Concept2</span><span class="special">,</span> <span class="identifier">Tag2</span> <span class="special">&gt;</span> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<p>Upcasts from an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> with stricter requirements to an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> with weaker requirements.</p>
<p>




</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">other</code></span></p></td>
<td><p>The object to make a copy of.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must contain <a class="link" href="constructible.html" title="Struct template constructible">constructible&lt;T(const T&amp;)&gt;</a>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must not refer to any non-deduced placeholder besides <code class="computeroutput">T</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>After substituting <code class="computeroutput">T</code> for <code class="computeroutput">Tag2</code>, the requirements of <code class="computeroutput">Concept2</code> must be a superset of the requirements of <code class="computeroutput">Concept</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the copy constructor of the contained type throws. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept2<span class="special">,</span> <span class="keyword">typename</span> Tag2<span class="special">,</span> <span class="keyword">typename</span> Map<span class="special">&gt;</span> 
  <a name="id-1_3_40_13_1_1_1_1_9-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a><span class="special">&lt;</span> <span class="identifier">Concept2</span><span class="special">,</span> <span class="identifier">Tag2</span> <span class="special">&gt;</span> <span class="special">&amp;</span> other<span class="special">,</span> 
      <span class="keyword">const</span> <a class="link" href="static_binding.html" title="Struct template static_binding">static_binding</a><span class="special">&lt;</span> <span class="identifier">Map</span> <span class="special">&gt;</span> <span class="special">&amp;</span> binding<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> from another <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>.</p>
<p>




</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">binding</code></span></p></td>
<td><p>Specifies the mapping between the placeholders used by the two concepts.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">other</code></span></p></td>
<td><p>The object to make a copy of. </p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must contain <a class="link" href="constructible.html" title="Struct template constructible">constructible&lt;T(const T&amp;)&gt;</a>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Map</code> must be an MPL map with keys for all the non-deduced placeholders used by <code class="computeroutput">Concept</code> and values for the corresponding placeholders in <code class="computeroutput">Concept2</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>After substituting placeholders according to <code class="computeroutput">Map</code>, the requirements of <code class="computeroutput">Concept2</code> must be a superset of the requirements of <code class="computeroutput">Concept</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the copy constructor of the contained type throws. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept2<span class="special">,</span> <span class="keyword">typename</span> Tag2<span class="special">&gt;</span> 
  <a name="id-1_3_40_13_1_1_1_1_10-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="any.html" title="Class template any">any</a><span class="special">&lt;</span> <span class="identifier">Concept2</span><span class="special">,</span> <span class="identifier">Tag2</span> <span class="special">&gt;</span> <span class="special">&amp;</span> other<span class="special">,</span> <span class="keyword">const</span> <a class="link" href="binding.html" title="Class template binding">binding</a><span class="special">&lt;</span> <span class="identifier">Concept</span> <span class="special">&gt;</span> <span class="special">&amp;</span> binding<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code> from another <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>.</p>
<p>




</p>
<div class="warning"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../doc/src/images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>This constructor is potentially dangerous, as it cannot check at compile time whether the arguments match. </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">binding</code></span></p></td>
<td><p>Specifies the bindings of placeholders to actual types.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">other</code></span></p></td>
<td><p>The object to make a copy of. </p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must contain <a class="link" href="constructible.html" title="Struct template constructible">constructible&lt;T(const T&amp;)&gt;</a>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>The type stored in <code class="computeroutput">other</code> must match the type expected by <code class="computeroutput">binding</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>binding_of(*this) == <code class="computeroutput">binding</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the copy constructor of the contained type throws.</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> U<span class="special">&gt;</span> <span class="keyword">explicit</span> <a name="id-1_3_40_13_1_1_1_1_11-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">...</span> arg<span class="special">)</span><span class="special">;</span></pre>
<p>Calls a constructor of the contained type. The bindings will be deduced from the arguments.</p>
<p>




</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This constructor is never chosen if any other constructor can be called instead. </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">arg</code></span></p></td>
<td><p>The arguments to be passed to the underlying constructor.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must contain an instance of <a class="link" href="constructible.html" title="Struct template constructible">constructible</a> which can be called with these arguments. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>At least one of the arguments must by an <a class="link" href="any.html" title="Class template any">any</a> with the same <code class="computeroutput">Concept</code> as this. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>The bindings of all the arguments that are <a class="link" href="any.html" title="Class template any">any</a>'s, must be the same.</p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the constructor of the contained type throws.</td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span><span class="special">...</span> U<span class="special">&gt;</span> 
  <span class="keyword">explicit</span> <a name="id-1_3_40_13_1_1_1_1_12-bb"></a><span class="identifier">any</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="binding.html" title="Class template binding">binding</a><span class="special">&lt;</span> <span class="identifier">Concept</span> <span class="special">&gt;</span> <span class="special">&amp;</span> binding<span class="special">,</span> <span class="identifier">U</span> <span class="special">&amp;&amp;</span><span class="special">...</span> arg<span class="special">)</span><span class="special">;</span></pre>
<p>Calls a constructor of the contained type.</p>
<p>




</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">arg</code></span></p></td>
<td><p>The arguments to be passed to the underlying constructor.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">binding</code></span></p></td>
<td><p>Specifies the bindings of placeholders to actual types. </p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> must contain a matching instance of <a class="link" href="constructible.html" title="Struct template constructible">constructible</a>. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>The contained type of every argument that is an <a class="link" href="any.html" title="Class template any">any</a>, must be the same as that specified by <code class="computeroutput">binding</code>.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>binding_of(*this) == <code class="computeroutput">binding</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or whatever that the constructor of the contained type throws. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a class="link" href="any.html" title="Class template any">any</a> <span class="special">&amp;</span> <a name="id-1_3_40_13_1_1_1_1_13-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="identifier">U</span> <span class="special">&amp;&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<p>Assigns to an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>.</p>
<p>If an appropriate overload of <code class="computeroutput"><a class="link" href="assignable.html" title="Struct template assignable">assignable</a></code> is not available and <code class="computeroutput"><a class="link" href="relaxed.html" title="Struct relaxed">relaxed</a></code> is in <code class="computeroutput">Concept</code>, falls back on constructing from <code class="computeroutput">other</code>.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>If <code class="computeroutput">U</code> is an <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>, then this can decide dynamically whether to use construction based on the type stored in other.</p></td></tr>
</table></div>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Whatever the assignment operator of the contained type throws. When falling back on construction, throws <code class="computeroutput">std::bad_alloc</code> or whatever the move (or copy) constructor of the contained type throws. In this case move assignment provides the strong exception guarantee. When calling a (move) assignment operator of the contained type, the exception guarantee is whatever the contained type provides. </td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="id-1_3_40_13_1_1_1_1_14-bb"></a><span class="special">~</span><span class="identifier">any</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">Concept</code> includes <a class="link" href="destructible.html" title="Struct template destructible">destructible&lt;T&gt;</a>. </p></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.40.13.2.3.4.6"></a><h3>Specializations</h3>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><a class="link" href="any_Conc_1_3_40_13_1_1_1_2.html" title="Class template any&lt;Concept, const T &amp;&gt;">Class template any&lt;Concept, const T &amp;&gt;</a></p></li>
<li class="listitem"><p><a class="link" href="any_Conc_1_3_40_13_1_1_1_3.html" title="Class template any&lt;Concept, T &amp;&gt;">Class template any&lt;Concept, T &amp;&gt;</a></p></li>
<li class="listitem"><p><a class="link" href="any_Conc_1_3_40_13_1_1_1_4.html" title="Class template any&lt;Concept, T &amp;&amp;&gt;">Class template any&lt;Concept, T &amp;&amp;&gt;</a></p></li>
</ul></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2011-2013 Steven Watanabe<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../boost_typeerasure/reference.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.any_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="any_Conc_1_3_40_13_1_1_1_2.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
